<!doctype html>
<html>
    <head>
        <title>AudioTrackList &amp; VideoTrackList.getTrackById</title>
        <script src="../../resources/testharness.js"></script>
        <script src="../../resources/testharnessreport.js"></script>
            </head>
    <body>
        <script>
            async_test(function(t)
            {
                var video = document.createElement('video');

                assert_equals(video.audioTracks.length, 0);
                assert_equals(video.audioTracks.getTrackById(''), null);

                assert_equals(video.videoTracks.length, 0);
                assert_equals(video.videoTracks.getTrackById(''), null);

                video.src = '../content/test.ogv';

                video.addEventListener('loadedmetadata', t.step_func_done(function()
                {
                    assert_equals(video.audioTracks.length, 1);
                    assert_equals(video.audioTracks.getTrackById(video.audioTracks[0].id), video.audioTracks[0]);
                    assert_equals(video.audioTracks.getTrackById('fake-id'), null);

                    assert_equals(video.videoTracks.length, 1);
                    assert_equals(video.videoTracks.getTrackById(video.videoTracks[0].id), video.videoTracks[0]);
                    assert_equals(video.videoTracks.getTrackById('fake-id'), null);
                }));
            });
        </script>
    </body>
</html>
